<template>
	<view class="container" :loading="loading">
		<view v-for="(item, index) in list" :key="index">
			<uni-card :title="`${item.name}`" type="line">
				<uni-row class="font-9">
					流程定义名称：{{item.processDefinitionName}}
				</uni-row>
				<uni-row class="font-9">
					任务名称：{{item.name}}
				</uni-row>
				<uni-row class="font-9">
					办理人：{{item.assignee}}
				</uni-row>
			</uni-card>
		</view>
		<uni-card type="line">
			<uni-pagination :total="total" :current="params.pageNum" :pageSize="params.pageSize" :showIcon="true" @change="pageChange" />
		</uni-card>
	</view>
</template>

<script>
	import taskApi from "@/api/workflow/task.js";
	
	export default {
		data() {
			return {
				// 加载中
				loading: true,
				// 列表数据
				list: [],
				// 总条数
				total: 0,
				// 查询参数
				params: {
					pageNum: 0,
					pageSize: 5
				},
			}
		},
		created () {
			this.getList();
		},
		methods: {
			// 查询列表
			getList () {
				this.loading =true
				taskApi.getTaskFinishByPage(this.params).then(res => {
					this.list = res.rows;
					this.total = res.total;
					this.loading =false
				})
			},
			// 翻页
			pageChange(e){
				this.params.pageNum = e.current;
				this.getList()
			},
		}
	}
</script>

<style>

</style>
